Skip to content

fix: correctly assign targetVersion for parent-update targets - #1121

Open
RohithPariki wants to merge 4 commits into
OWASP:mainfrom
RohithPariki:fix-1007-cross-wired-version
Open

fix: correctly assign targetVersion for parent-update targets#1121
RohithPariki wants to merge 4 commits into
OWASP:mainfrom
RohithPariki:fix-1007-cross-wired-version

Conversation

@RohithPariki

@RohithPariki RohithPariki commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

What changed and why

The targetVersion for parent-update was being incorrectly populated with the child dependency's safe version (targetChildVersion). During map insertion, if the parent was also flagged as a direct finding, its correct targetVersion could be overwritten by this incorrect child version due to version comparison sorting, resulting in cross-wired suggested commands.

This assigns currentVersion to targetVersion for parent-update targets, preventing incorrect version merging while correctly indicating no direct version change is needed in the UI.

Closes #1007

@sonukapoor

Copy link
Copy Markdown
Collaborator

Thanks for this, and apologies for the slow response.

This overlaps with #1113, which @osfv opened two days earlier and which fixes the same issue from a different angle. Under the first-working-PR-wins rule that one has the claim, so I want to be straight that this PR will not merge as it stands.

But it is not wasted work, and I would rather explain why than just close it.

#1113 fixes the structure. The root cause is that a parent-update target and a direct finding on the same parent collide in a map keyed by package name, and it rekeys that map. What it does not fix is plan.targets, so the JSON, the terminal table and the HTML report still pair the parent with the child's version. You found that half, and you are the only one who touched the output surfaces and the docs that describe them.

So what I would like, if you are up for it: once #1113 lands, rebase this on top with just the targetVersion change and the docs. Both of you get credit for the part you actually fixed.

One thing to settle first, and it is my call rather than yours. For update-parent-within-range the fix is npm update <parent>, so the parent's version in package.json does not change. Setting targetVersion to currentVersion makes the table read "axios 1.2.0 to 1.2.0", which is not wrong so much as meaningless. I think the honest answer is null with a dash in the Fixed column, but I want to look at how that renders before asking you to build it. I will follow up here.

Also, body.md looks like it was committed by accident. Worth dropping when you rebase.

Fixes OWASP#1007. Assigns the parent's currentVersion instead of the child's targetChildVersion to the parent-update target, preventing incorrect version merging for direct dependencies.
@RohithPariki
RohithPariki force-pushed the fix-1007-cross-wired-version branch from 6d9d87f to 9bcc543 Compare September 14, 2026 18:39
@RohithPariki
RohithPariki marked this pull request as ready for review September 14, 2026 18:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

suggestedFixCommands emits a version that does not exist (cross-wired from another finding)

2 participants